import java.util.Arrays;

public class Solution2226 {
    public int maximumCandies(int[] candies, long k) {
        int l=1,r= Arrays.stream(candies).max().getAsInt(),ans=0;
        while (l<=r){
            int mid=(l+r)/2;
            long total=0;
            for (int candy : candies) {
                total+=candy/mid;
            }
            if (total>=k){
                ans=mid;
                l=mid+1;
            }else {
                r=mid-1;
            }
        }
        return ans;
    }

    public static void main(String[] args) {
        System.out.println(new Solution2226().maximumCandies(new int[]{5,8,6},3));
    }
}
